<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>客户组织机构</title>
		<%@ include file="/include/resources.jsp" %>
	</head>
	<body>
		<script type="text/javascript" src="msi/customer/chkorg.js"></script>
		
		<div style="padding:5px;background:#fafafa;border-bottom:1px solid #eee;">
			<table cellpadding="0" cellspacing="0" style="width:100%">
				<tr>
					<td>
						<a id="btn-submit1" href="#" class="easyui-linkbutton" plain="true" iconCls="icon-save" onclick="javascript:submitQuestion(1)">保存</a>
						<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-cancel" onclick="javascript:$('#questionDialog').dialog('close')">关闭</a>
					</td>
				</tr>
			</table>
		</div>
		<div style="padding:10px">
			<div style="padding-left:5px;padding-right: 5px">
				<form action="" method="post" id="questionForm">
				<input type="hidden" name="question.questionId" value='<s:property value="question.questionId"/>'/>
				<input type="hidden" name="question.sortId" value='<s:property value="question.sortId"/>'/>
				<input type="hidden" name="question.text" value='' id="optionText"/>
				<table cellpadding="0" cellspacing="3" >
					<tr>
						<th>题型:</th>
						<td colspan="3">
							<select name="question.questionType" id="questionTypeSelect" editable="false">
								<option value="">请选择</option>
								<option value="R" <s:if test='question.questionType=="R"'>selected="selected"</s:if>>单选题</option>
								<option value="C" <s:if test='question.questionType=="C"'>selected="selected"</s:if>>多选题</option>
								<option value="F" <s:if test='question.questionType=="F"'>selected="selected"</s:if>>填空题</option>
								<option value="A" <s:if test='question.questionType=="A"'>selected="selected"</s:if>>问答题</option>
							</select>
						</td>
					</tr>
					<tr>
						<th>标题:</th>
						<td colspan="3">
							<input type="text" name="question.questionTitle" value='<s:property value="question.questionTitle"/>'/>
						</td>
					</tr>
				</table>
				</form>
			</div>
			<div id="options" style="margin:10px 0;">
				<table id="optionsListTable" toolbar="#optionToolbar" style="height:295px" fitColumns="true" singleSelect="true" rownumbers="true" showFooter="true">
					<thead>
						<tr>
							<th field="optionName" width="120" editor="text">选项名称</th>
						</tr>
					</thead>
					<s:iterator value="question.options" id="option">
						<tr>
							<td width="120" editor="text"><s:property value="#option.optionName"/></td>
						</tr>
					</s:iterator>
				</table>
			</div>
			<div id="optionToolbar" class="toolbar">
				<table cellpadding="0" cellspacing="0" style="width:100%">
					<tr>
						<td>
							<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="appendRow();">添加选项</a>
							<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="deleteRow();">删除选项</a>
							<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="acceptRow();">确认</a>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<script type="text/javascript">
			$(function(){
				$('#optionsListTable').datagrid({
					width : 440,
					onClickRow:function(rowIndex){
						$('#optionsListTable').datagrid('acceptChanges');
						$('#optionsListTable').datagrid('beginEdit', rowIndex);
					}
				});
				$("#questionTypeSelect").combobox({
	        	    onChange:function(newValue,oldValue){
	        	    	if(newValue == "R" || newValue == "C") {
	        	    		$("#options").show();
	        	    	} else {
	        	    		$("#options").hide();
	        	    	}
	        	    }
	        	});
			});
		</script>
	</body>
</html>